export function getSimpleBarOption (data, colors, config) {
	let label = []
  let legend = []
	colors = colors || ['#13c0c4']
	const colorlen = colors.length
	let series = []
  const opt = Object.assign({
    label: []
  }, config)
	for (let i = 0; i < data.length; i++) {
		data[i].name && legend.push(data[i].name)
		series.push({
      name: data[i].name,
      type: 'bar',
      barWidth: 10,
      data: data[i].list,
      label: { normal: { show: false } },
      itemStyle: { normal: { color: colors[i % colorlen] } }
    })
	}
	if (opt.label.length) {
    label = opt.label
  } else {
    for (let i = 0; i < data[0].list.length; i++) {
      const item = data[0].list[i]
      label.push(item.name)
    }
  }
  return {
		legend: { data: legend, itemWidth: 10, itemHeight: 10 },
    tooltip: { show: true, trigger: 'axis', axisPointer: { type: 'shadow' } },
    grid: { left: 12, top: 30, bottom: 20, right: 20, containLabel: true },
    yAxis: {
      type: 'value',
      axisLabel: { show: true, textStyle: { color: '#666', fontSize: 10 } },
      axisLine: { show: false },
      axisTick: { show: false },
      splitLine: { show: true, lineStyle: { color: '#ccc', type: 'dashed' } }
    },
    xAxis: {
      type: 'category',
      min: 0,
      nameTextStyle: { color: '#66afff', fontSize: 12 },
      axisLabel: { margin: 15, textStyle: { color: '#666', fontSize: 10 }, interval: 0 },
      axisLine: { show: true, lineStyle: { color: '#ccc' } },
      splitLine: { show: false },
      axisTick: { show: false },
      data: label
    },
    series: series
  }
}
